<?php include('../conectar.php'); error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING); ?>
<html>
<head>
	<title>Agregar Usuario</title>
</head>
<body>
<center>
<form action="guardar.php" method="post">
	<table>
		<tr>
			<td>CODIGO: </td>
			<td><input type="text" name="idusu" value="<?=$_GET['idusu'];  ?>" maxlength="12" autofocus required></td>
		</tr>
		<tr>
			<td>CLAVE: </td>
			<td><input type="password" name="clave" maxlength="10" required></td>
		</tr>
		<tr>
			<td>NOMBRE: </td>
			<td><input type="text" name="nombre" value="<?=$_GET['nombre'];  ?>" maxlength="130" required></td>
		</tr>
		<tr>
			<td>DIRECCION: </td>
			<td><input type="text" name="direccion" value="<?=$_GET['direccion'];  ?>" maxlength="180" required></td>
		</tr>
		<tr>
			<td>TELEFONO: </td>
			<td><input type="text" name="telefono" value="<?=$_GET['telefono'];  ?>" maxlength="13" required></td>
		</tr>
		<tr>
			<td>NIVEL: </td>
			<td>
				<select name="nivel">
				<?php $busniv=mysql_query("select CODPARAM, DESPARAM from tabparam where TIPPARAM='CARGOS' and ESTREGIST='AC'"); 
					while($niv=mysql_fetch_row($busniv)){ ?>
						<?php if($_GET['nivel']==$niv[0]){ ?>
						<option value="<?=$niv[0] ?>" selected ><?=$niv[1]; ?></option>
					<?php }else{?>
						<option value="<?=$niv[0] ?>" > <?=$niv[1]; ?> </option>
					<?php } ?>
					<?php } ?>
				</select>
			</td>
		</tr>
		<tr>
			<td>ESTADO: </td>
			<td>
			<select name="estado">
				<?php $busest=mysql_query("select CODPARAM, DESPARAM from tabparam where TIPPARAM='ESTADO' and ESTREGIST='AC'"); 
					while($est=mysql_fetch_row($busest)){ ?>
						<?php if($_GET['estado']==$est[0]){ ?>
						<option value="<?=$est[0] ?>" selected ><?=$est[1]; ?></option>
					<?php }else{ ?>
						<option value="<?=$est[0] ?>" ><?=$est[1]; ?></option>
					<?php } ?> 
					<?php } ?>
				</select>
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center"><input type="submit" value="Guardar" ><input type="button" value="Regresar a la Lista" onclick="window.open('../index.php','_parent')"></td>
		</tr>
	</table>
</form>
</center>
</body>
</html>